﻿@model dai_hoc_tuong_lai.Areas.Admin.Models.ThongbaoModel
@{  AjaxOptions ajaxOpts = new AjaxOptions
    {
        HttpMethod = "post",
         OnComplete = "completedAjaxRequest",
        OnBegin = "show_Loading",
    };
}

<script type="text/javascript">

    function completedAjaxRequest(obj) {

        var returnObj = eval('(' + obj.responseText + ')');

        $('#box-busy').fadeOut('medium', function () {
            $('.black_overlay').css('display', 'none');
        });

        if (returnObj.Status == "success") {
            if (returnObj.Message != null) {
                makeSuccessHighlight(returnObj.Message);
            }
            else if (returnObj.RedirectUrl != null) {
                window.location.href = returnObj.RedirectUrl;
            }
        } else {
            makeErrorHighlight(returnObj.Message);
        }

        return false;
    }

    function makeErrorHighlight(messageStr) {
        var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span><strong>Alert: </strong>" + messageStr + "</p></div>");
        $highlight.addClass("ui-state-highlight ui-corner-all");
        $highlight.prependTo(".warning-area");
        $highlight.delay(4000).fadeOut(500);
    }

    function makeSuccessHighlight(messageStr) {
        var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span><strong>Success: </strong>" + messageStr + "</p></div>");
        $highlight.addClass("ui-state-highlight ui-corner-all");
        $highlight.prependTo(".warning-area");
        $highlight.delay(4000).fadeOut(500);
    }



    $(document).ready(function () {

        CKEDITOR.replace('ckeditorId', {
            filebrowserImageUploadUrl: '/Admin/Admin/UploadImage',
            height: "600"
        });
        $("#tabasAddCategory").tabs();
        var thumblogo = $("img#imageslogo");
        var buttonlogo = $("#event-logo-upload")[0];
        var uploader = new qq.FileUploader({
            element: buttonlogo,
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
            sizeLimit: 2147483647, // max size
            action: '/Admin/Admin/UploadImageStr',
            multiple: false,
            onSubmit: function (file, extension) {
                //$('div.preview').addClass('loading');
            },
            onComplete: function (id, fileName, responseJSON) {
                $("#idlogopage").val(responseJSON.filePath);
                thumblogo.attr('src', responseJSON.filePath);
                thumblogo.css('display', 'block');
            }
        });
    });

   
</script>


<div class="pageManager">
    @using (Ajax.BeginForm("AddOrUpdate", "Thongbao", null, ajaxOpts, new { enctype = "multipart/form-data" }))
{
    <div class="section-header">
        <dl class="submit">
            <img class="NFButtonLeft" src="img/0.png" style="border: 0" />
            <input type="submit" name="submit" id="submit" value="Submit" class="NFButton">
            <img src="img/0.png" class="NFButtonRight" style="border: 0" />
        </dl>
    </div>
    <div id="tabasAddCategory">
        <ul>
            <li><a href="#tabs-1">Chi tiết</a></li>
            <li><a href="#tabs-2">Nội dung</a></li>
            <li><a href="#tabs-3">Seo</a></li>
        </ul>
        <div id="tabs-1">
            <table>
                <tr>
                    <td colspan="2">
                        @Html.HiddenFor(model => model.Id, new { id = "Id" })
                        @Html.HiddenFor(model => model.Datecreate)
                        @Html.HiddenFor(model => model.Images, new { id = "idlogopage" })
                        <div class="warning-area">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="adminTitle">
                        @Html.LabelFor(model => model.Title, "Tiêu đề thông tin tuyển sinh"):
                    </td>
                    <td class="adminData">
                        @Html.TextBoxFor(model => Model.Title, new { @style = "width:580px" })
                        @Html.ValidationMessageFor(model => model.Title)
                    </td>
                </tr>
                <tr>
                    <td class="adminTitle">
                        @Html.LabelFor(model => model.Description, "Mô tả"):
                    </td>
                    <td class="adminData">
                        @Html.TextAreaFor(model => Model.Description, new { rows = "7", cols = "80" })
                        @Html.ValidationMessageFor(model => model.Description)
                    </td>
                </tr>
                
                <tr>
                    <td class="adminTitle">
                        @Html.LabelFor(model => model.Images, "Ảnh đại diện"):
                    </td>
                    <td class="adminData">
                         <div id="event-logo-upload" style="">
                        </div>
                        <img src="@Model.Images" id="imageslogo" width="100px" height="70px" />
                    </td>
                </tr>
                <tr>
                    <td class="adminTitle">
                        @Html.LabelFor(model => model.Active, "Trạng thái hiển thị"):
                    </td>
                    <td class="adminData">
                        @Html.EditorFor(x => x.Active)
                        @Html.ValidationMessageFor(model => model.Active)
                    </td>
                </tr>
            </table>
        </div>
        <div id="tabs-2">
            <table>
                <tr>
                    <td class="adminTitle">
                        @Html.LabelFor(model => model.ContentFull, "Nội dung"):
                    </td>
                    <td class="adminData">
                        @Html.TextAreaFor(model => Model.ContentFull, new { @class = "ckeditorId", id = "ckeditorId" })
                        @Html.ValidationMessageFor(model => model.ContentFull)
                    </td>
                </tr>
            </table>
        </div>
        <div id="tabs-3">
            <table>
            <tr>
                <td class="adminTitle">
                    @Html.LabelFor(model => model.MetaTitle, "Meta Title"):
                </td>
                <td class="adminData">
                    @Html.TextAreaFor(model => Model.MetaTitle, new { rows = "3", cols = "50" })
                    @Html.ValidationMessageFor(model => model.MetaTitle)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.LabelFor(model => model.MetaKeywords, "Meta Keywords"):
                </td>
                <td class="adminData">
                    @Html.TextAreaFor(model => Model.MetaKeywords, new { rows = "6", cols = "50" })
                    @Html.ValidationMessageFor(model => model.MetaKeywords)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.LabelFor(model => model.MetaDescription, "Meta Description"):
                </td>
                <td class="adminData">
                    @Html.TextAreaFor(model => Model.MetaDescription, new { rows = "10", cols = "50" })
                    @Html.ValidationMessageFor(model => model.MetaDescription)
                </td>
            </tr>
    </table>
        </div>
    </div>
}

</div>
